package com.jdkreader.jvm;


import java.util.ArrayList;
import java.util.List;

/**
 * 测试OutOfMemoryError
 *
 * VM Args： -Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError
 */
public class HeapOOM {

    static class OOMObject{

    }

    public static void main(String[] args) {
        //System.out.println("123");

        List<OOMObject> list= new ArrayList<>();

        while(true){
            list.add(new OOMObject());
        }
    }
}
